<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<div id="main">
			用户名：<input type="text" name="name"/>
		</div>
		<ul id="ul1">
			<li>NO.1</li>
			<li>NO.2</li>
			<li>NO.3</li>
			<li>NO.4</li>
		</ul>
		<script type="text/javascript">
			var ul=document.getElementById("ul1")
			document.write("<br />节点名称:"+ul.nodeName);
			document.write("<br />节点类型:"+ul.nodeType);
			document.write("<br />获取节点:"+ul.firstElementChild);
			document.write("<br />节点文本:"+ul.firstElementChild.firstChild.nodeName);
			document.write("<br />节点文本:"+ul.firstElementChild.firstChild.nodeType);
			var inp=document.getElementsByName("name")[0];
			inp.setAttribute("type","button");
			inp.setAttribute("value","按钮")
		</script>
	</body>
</html>
